//
//  HB+ASIHTTPRequest.m
//  Growth_iPhone
//
//  Created by Steven on 8/8/12.
//  Copyright (c) 2012 MEET Studio. All rights reserved.
//

#import "HB+ASIHTTPRequest.h"

@implementation ASIHTTPRequest(HB_ASIHTTPRequest)

+ (id)requestWithURL:(NSURL *)newURL isHeader:(BOOL)isHeader
{
    CLog(@"Request URL :%@", newURL);
    ASIHTTPRequest *newRequest = [[ASIHTTPRequest alloc] initWithURL:newURL];
    
    [newRequest setTimeOutSeconds:5.0];
    
    //统一安全验证
    NSString *UserCode = [[NSUserDefaults standardUserDefaults] valueForKey:@"Ucenter-Code"];
    NSString *UserVerifyCode = [[NSUserDefaults standardUserDefaults] valueForKey:@"Ucenter-VerifyCode"];
    
    if (isHeader) {
        if (UserCode) {
            [newRequest addRequestHeader:@"Ucenter-Code" value:UserCode];
        }
        if (UserVerifyCode) {
            [newRequest addRequestHeader:@"Ucenter-VerifyCode" value:UserVerifyCode];
        }
        
        [newRequest addRequestHeader:@"Ucenter-Authorization" value:UCENTER_AUTHORIZATION];
    }
    
    return newRequest;
}
@end
